package com.mf.ergate.api.auth;

import com.mf.ergate.api.ApiConfig;
import com.mf.ergate.api.auth.model.dto.ResourceInfoCreateDto;
import com.mf.ergate.api.auth.model.dto.ResourceInfoDeleteDto;
import com.mf.ergate.api.auth.model.dto.ResourceInfoQueryDto;
import com.mf.ergate.api.auth.model.dto.ResourceInfoUpdateDto;
import com.mf.ergate.api.auth.model.vo.ResourceInfoVo;
import com.mf.framework.common.model.Page;
import com.mf.framework.common.model.RemotePage;
import com.mf.framework.common.model.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * 资源信息RemoteService层接口类
 * User: zhaoming
 * DateTime: 2018-10-10
 * To change this template use File | Settings | File Templates.
 **/
@Api(value = "/api/resourceInfo", tags = "ResourceInfoController", description = "资源信息服务")
@FeignClient(name= ApiConfig.SERVICE_NAME)
@RequestMapping("/api/resourceInfo")
public interface ResourceInfoRemoteService{

    /**
     * 新增
     * @param resourceInfoCreateDto 资源信息新增Dto
     * @return 资源信息
     */
    @ApiOperation(value = "新增")
    @ApiImplicitParam(name = "resourceInfoCreateDto", value = "资源信息新增Dto", dataType = "ResourceInfoCreateDto",  required = true, paramType = "body")
    @RequestMapping(value = "/insert", method = RequestMethod.POST)
    Result<ResourceInfoVo> insert(@RequestBody ResourceInfoCreateDto resourceInfoCreateDto);

    /**
     * 根据唯一编号更新
     * @param resourceInfoUpdateDto 资源信息更新Dto
     * @return 执行结果
     */
    @ApiOperation(value = "根据唯一编号更新")
    @ApiImplicitParam(name = "resourceInfoUpdateDto", value = "资源信息更新Dto", dataType = "ResourceInfoUpdateDto",  required = true, paramType = "body")
    @RequestMapping(value = "/updateByUniqueNo", method = RequestMethod.POST)
    Result<Boolean> updateByUniqueNo(@RequestBody ResourceInfoUpdateDto resourceInfoUpdateDto);

    /**
     * 根据唯一编号删除(逻辑删除)
     * @param resourceInfoDeleteDto 资源信息删除Dto
     * @return 执行结果
     */
    @ApiOperation(value = "根据唯一编号删除(逻辑删除)")
    @ApiImplicitParam(name = "resourceInfoDeleteDto", value = "资源信息删除Dto", dataType = "ResourceInfoDeleteDto",  required = true, paramType = "body")
    @RequestMapping(value = "/deleteByUniqueNo", method = RequestMethod.POST)
    Result<Boolean> deleteByUniqueNo(@RequestBody ResourceInfoDeleteDto resourceInfoDeleteDto);

    /**
     * 根据唯一编号查询
     * @param resourceNo 资源编号
     * @return 资源信息
     */
    @ApiOperation(value = "根据唯一编号查询")
    @ApiImplicitParam(name = "resourceNo", value = "资源编号", dataType = "String",  required = true, paramType = "body")
    @RequestMapping(value = "/selectByUniqueNo", method = RequestMethod.POST)
    Result<ResourceInfoVo> selectByUniqueNo(@RequestBody String resourceNo);

    /**
     * 根据条件查询
     * @param resourceInfoQueryDto 资源信息查询Dto
     * @return 资源信息列表
     */
    @ApiOperation(value = "根据条件查询")
    @ApiImplicitParam(name = "resourceInfoQueryDto", value = "资源信息查询Dto", dataType = "ResourceInfoQueryDto",  required = true, paramType = "body")
    @RequestMapping(value = "/selectByCondition", method = RequestMethod.POST)
    Result<List<ResourceInfoVo>> selectByCondition(@RequestBody ResourceInfoQueryDto resourceInfoQueryDto);

    /**
     * 根据条件查询数量
     * @param resourceInfoQueryDto 资源信息查询Dto
     * @return 数量
     */
    @ApiOperation(value = "根据条件查询数量")
    @ApiImplicitParam(name = "resourceInfoQueryDto", value = "资源信息查询Dto", dataType = "ResourceInfoQueryDto",  required = true, paramType = "body")
    @RequestMapping(value = "/selectCount", method = {RequestMethod.POST})
    Result<Integer> selectCount(@RequestBody ResourceInfoQueryDto resourceInfoQueryDto);

    /**
     * 根据条件分页查询
     * @param remotePage 远程分页
     * @return 资源信息分页列表
     */
    @ApiOperation(value = "根据条件分页查询")
    @ApiImplicitParam(name = "remotePage", value = "远程分页", dataType = "RemotePage",  required = true, paramType = "body")
    @RequestMapping(value = "/selectPage", method = {RequestMethod.POST})
    Result<Page<ResourceInfoVo>> selectPage(@RequestBody RemotePage<ResourceInfoQueryDto> remotePage);

    /**
     * 根据应用类型编码与用户编号查询
     * @param appTypeCode 应用类型编码
     * @param userNo 用户编号
     * @return 资源信息列表
     */
    @ApiOperation(value = "根据用户编号查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "appTypeCode", value = "应用类型编码", dataType = "String",  required = true),
            @ApiImplicitParam(name = "userNo", value = "用户编号", dataType = "String",  required = true)
    })
    @RequestMapping(value = "/selectByAppTypeCodeAndUserNo", method = RequestMethod.GET)
    Result<List<ResourceInfoVo>> selectByAppTypeCodeAndUserNo(@RequestParam("appTypeCode") String appTypeCode, @RequestParam("userNo") String userNo);

    /**
     * 删除资源及相关信息(逻辑删除)
     * @param resourceInfoDeleteDto 资源信息删除Dto
     * @return 执行结果
     */
    @ApiOperation(value = "删除资源及相关信息(逻辑删除)")
    @ApiImplicitParam(name = "resourceInfoDeleteDto", value = "资源信息删除Dto", dataType = "ResourceInfoDeleteDto",  required = true, paramType = "body")
    @RequestMapping(value = "/deleteCompleteByUniqueNo", method = RequestMethod.POST)
    Result<Boolean> deleteCompleteByUniqueNo(@RequestBody ResourceInfoDeleteDto resourceInfoDeleteDto);
}
